import 'package:flutter/material.dart';
import 'package:hkzf/pages/home/info/data.dart';
import 'package:hkzf/widgets/common_image.dart';

const textStyle = TextStyle(color: Colors.black54);

class ItemWidget extends StatelessWidget {
  final InfoItem data;
  const ItemWidget({Key key, this.data}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        print('123');
        // Navigator.pushNamed(context, data.navigateUri);
        Navigator.of(context).pushNamed('/room/${data.id}');
      },
      child: Container(
        height: 200,
        padding: EdgeInsets.only(top: 10, right: 10, bottom: 10),
        child: Row(
          children: [
            CommonImage(
              data.imageUri,
              width: 120,
              height: 90,
            ),
            Padding(
              padding: EdgeInsets.only(left: 10),
            ),
            Expanded(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text(
                    data.title,
                    style: TextStyle(
                        fontWeight: FontWeight.w600, color: Colors.black),
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text(
                        data.source,
                        style: textStyle,
                      ),
                      Text(
                        data.time,
                        style: textStyle,
                      ),
                    ],
                  )
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
